package com.tbb.app.base.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.tbb.app.base.dto.UserAddDTO;
import com.tbb.app.common.entity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 用户表
 *
 * @author Liu
 * @since 2022-01-11
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tbb_user")
@AllArgsConstructor
@NoArgsConstructor
public class User extends BaseEntity<User> {

    /**
     * 昵称
     */
    private String name;

    /**
     * 账号
     */
    private String account;

    /**
     * 密码
     */
    private String password;

    /**
     * 地区
     */
    private String location;

    /**
     * 性别，0-男，1-女
     */
    private Integer gender;

    /**
     * 头像url
     */
    private String profileImg;

    /**
     * 背景图url
     */
    private String backgroundImg;

    /**
     * 个性签名
     */
    private String profileText;

    /**
     * 管理员，0-普通用户，1-管理员
     */
    private Boolean isAdmin;

    public User(UserAddDTO dto) {
        this.name = dto.getName();
        this.account = dto.getAccount();
        this.location = dto.getLocation();
        this.gender = dto.getGender();
        this.profileImg = dto.getProfileImg();
        this.backgroundImg = dto.getBackgroundImg();
        this.profileText = dto.getProfileText();
    }
}
